<?php
/**
 * Comment Model.
 * @package    sitrack 
 * @author     Simon Downes <simon@simondownes.co.uk>
 * @copyright  Copyright (c) 2007, Simon Downes 
 * @license    http://www.opensource.org/licenses/mit-license.php
 */

/**
 * Comment Model.
 *
 * @package    sitrack 
 * @author     Simon Downes <simon@simondownes.co.uk>
 * @copyright  Copyright (c) 2007, Simon Downes 
 * @license    http://www.opensource.org/licenses/mit-license.php
 */
final class Comment extends SPF_Model {

   /**
    * Constructor.
    *
    * @return  object
    */
   public function __construct() {

      /* construct the parent object */
      parent::__construct('comments');
      
      
   } // __construct

   /**
    * Destructor.
    *
    * @return  void
    */
   public function __destruct() {
      parent::__destruct();
   }
   
   /**
    * Override the after_update() method to create a ticket history record when a comment is added.
    *
    * @param   boolean   $new    true if the record was inserted.
    * @return  void
    */
   public function after_update( $new ) {
      
      if( $new )
         Ticket::create_history( $this->ticket_id, array('added a comment') );
      
   } // after_update
   
} // Comment

?>
